package top.springcloud.FeignConsumer.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import top.springcloud.FeignConsumer.fallback.HelloServiceImpl;

/**
 * FeignClient指定要调用的服务名称
 */
@Service("helloService")
@FeignClient(value="service-customer-provider",fallback = HelloServiceImpl.class)
public interface HelloService {

    /**
     * 通过接口来远程调用服务
     * @param name String
     * @return String
     */
    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    String getHello(@RequestParam(value = "name") String name);

    /**
     * 查询用户
     * @param customerId
     * @return String
     */
    @RequestMapping(value = "/customer/get/{customerId}",method = RequestMethod.GET)
    String getCustomerByid(@PathVariable("customerId") Integer customerId);
    
}
